package com.intelligent.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 * 报价单信息表
 * @TableName quotation
 */
@TableName(value ="quotation")
@Data
public class Quotation implements Serializable {
    /**
     * 报价id
     */
    @TableId(type = IdType.AUTO)
    private Long quotationId;

    /**
     * 报价单号
     */
    private String quotationNo;

    /**
     * 审批状态(0 已通过 1 待审批 2 待审批)
     */
    private Integer approvalStatus;

    /**
     * 负责销售
     */
    private Long uId;

    /**
     * 报价时间
     */
    private Date quotationDate;

    /**
     * 客户名称
     */
    private Long customerId;

    /**
     * 期望发货时间
     */
    private Date expectedDeliveryDate;


     // 报价总金额

    private BigDecimal totalAmount;

    //订单状态(0 已成交 1 报价中 2 已拒绝)
    private Integer status;

    /**
     * 客户名称（关联查询字段，不存储到数据库）
     */
    @TableField(exist = false)
    private String customerName;

    /**
     * 销售姓名（关联查询字段，不存储到数据库）
     */
    @TableField(exist = false)
    private String salesPersonName;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Quotation other = (Quotation) that;
        return (this.getQuotationId() == null ? other.getQuotationId() == null : this.getQuotationId().equals(other.getQuotationId()))
            && (this.getQuotationNo() == null ? other.getQuotationNo() == null : this.getQuotationNo().equals(other.getQuotationNo()))
            && (this.getApprovalStatus() == null ? other.getApprovalStatus() == null : this.getApprovalStatus().equals(other.getApprovalStatus()))
            && (this.getUId() == null ? other.getUId() == null : this.getUId().equals(other.getUId()))
            && (this.getQuotationDate() == null ? other.getQuotationDate() == null : this.getQuotationDate().equals(other.getQuotationDate()))
            && (this.getCustomerId() == null ? other.getCustomerId() == null : this.getCustomerId().equals(other.getCustomerId()))
            && (this.getExpectedDeliveryDate() == null ? other.getExpectedDeliveryDate() == null : this.getExpectedDeliveryDate().equals(other.getExpectedDeliveryDate()))
            && (this.getTotalAmount() == null ? other.getTotalAmount() == null : this.getTotalAmount().equals(other.getTotalAmount()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getQuotationId() == null) ? 0 : getQuotationId().hashCode());
        result = prime * result + ((getQuotationNo() == null) ? 0 : getQuotationNo().hashCode());
        result = prime * result + ((getApprovalStatus() == null) ? 0 : getApprovalStatus().hashCode());
        result = prime * result + ((getUId() == null) ? 0 : getUId().hashCode());
        result = prime * result + ((getQuotationDate() == null) ? 0 : getQuotationDate().hashCode());
        result = prime * result + ((getCustomerId() == null) ? 0 : getCustomerId().hashCode());
        result = prime * result + ((getExpectedDeliveryDate() == null) ? 0 : getExpectedDeliveryDate().hashCode());
        result = prime * result + ((getTotalAmount() == null) ? 0 : getTotalAmount().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", quotationId=").append(quotationId);
        sb.append(", quotationNo=").append(quotationNo);
        sb.append(", approvalStatus=").append(approvalStatus);
        sb.append(", uId=").append(uId);
        sb.append(", quotationDate=").append(quotationDate);
        sb.append(", customerId=").append(customerId);
        sb.append(", expectedDeliveryDate=").append(expectedDeliveryDate);
        sb.append(", totalAmount=").append(totalAmount);
        sb.append(", status=").append(status);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
